package ui.datagrid
{
	import mx.collections.ArrayCollection;
	
	import spark.components.gridClasses.GridColumn;
	
	public class IndexGridColumn extends GridColumn
	{
		
		protected function getIndexLabelFunction(item:Object,column:GridColumn):String{
			var array:ArrayCollection = column.grid.dataGrid.dataProvider as ArrayCollection;
			var index:int = array.getItemIndex(item);
			return String(index+1);
		}
		
		public function IndexGridColumn(columnName:String=null)
		{
			super(columnName);
			this.labelFunction = getIndexLabelFunction;
			this.headerText = "序号";
			this.width = 40;
			this.resizable = false;
			this.editable = false;
			this.sortable = false;
		}
		
		
	}
}